Fix label alignment when width-chars is set. (#326098, Benjamin Otte)
authorMatthias Clasen <mclasen@redhat.com>
Sun, 8 Jan 2006 06:44:11 +0000 (06:44 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 8 Jan 2006 06:44:11 +0000 (06:44 +0000)
2006-01-08  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtklabel.c (get_layout_location): Fix label alignment
when width-chars is set.  (#326098, Benjamin Otte)

ChangeLog
ChangeLog.pre-2-10
gtk/gtklabel.c

index 73b69b76ba3d64632389bda52bba88efbb6c71c5..7d45d9888a693c4331a7c8c038e22086577d1866 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-01-08  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtklabel.c (get_layout_location): Fix label alignment 
+       when width-chars is set.  (#326098, Benjamin Otte)
+
        * gdk/gdkregion-generic.c (miRegionCopy): Fix this for the 
        single-rectangle case.  (#326127, Benjamin Berg)
        (gdk_region_copy): Use miRegionCopy() here.
index 73b69b76ba3d64632389bda52bba88efbb6c71c5..7d45d9888a693c4331a7c8c038e22086577d1866 100644 (file)
@@ -1,5 +1,8 @@
 2006-01-08  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtklabel.c (get_layout_location): Fix label alignment 
+       when width-chars is set.  (#326098, Benjamin Otte)
+
        * gdk/gdkregion-generic.c (miRegionCopy): Fix this for the 
        single-rectangle case.  (#326127, Benjamin Berg)
        (gdk_region_copy): Use miRegionCopy() here.
index 269d859767c57ac3861c476e302d63333a70510b..2c5509c311c395decf8562ec26d4001141fcee22 100644 (file)
@@ -2191,19 +2191,21 @@ get_layout_location (GtkLabel  *label,
                      gint      *yp)
 {
   GtkMisc *misc;
-  GtkWidget *widget;
+  GtkWidget *widget; 
+  GtkLabelPrivate *priv;
   gfloat xalign;
   gint req_width, x, y;
   
   misc = GTK_MISC (label);
   widget = GTK_WIDGET (label);
-  
+  priv = GTK_LABEL_GET_PRIVATE (label);
+
   if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
     xalign = misc->xalign;
   else
     xalign = 1.0 - misc->xalign;
 
-  if (label->ellipsize)
+  if (label->ellipsize || priv->width_chars > 0)
     {
       PangoRectangle ink_rect;